﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WuDada.Core.Post;
using WuDada.Core.Post.Service;
using WuDada.Core.Post.Domain;
using WuDada.Provider.ResourceHandle;
using WuDada.Provider.ResourceHandle.Service;
using WuDada.Provider.ResourceHandle.Domain;

public partial class act_in : System.Web.UI.Page
{
    private PostFactory m_PostFactory;
    private IPostService m_PostService;
    private StorageFactory m_StorageFactory;
    private IStorageFileService m_StorageFileService;

    private int m_StorageFileId = 0;

    protected void Page_Load(object sender, EventArgs e)
    {
        m_PostFactory = new PostFactory();
        m_PostService = m_PostFactory.GetPostService();
        m_StorageFactory = new StorageFactory();
        m_StorageFileService = m_StorageFactory.GetStorageFileService();

        m_StorageFileId = QueryStringHelper.GetInteger("id", 0);

        if (!IsPostBack)
        {
            StorageFileVO storageFileVO = m_StorageFileService.GetStorageFileById(m_StorageFileId);
            if (storageFileVO != null)
            {
                PostVO postVO = m_PostService.GetPostById(storageFileVO.SourceId);
                ltlPost.Text = postVO.Title;
                ltlTitle.Text = storageFileVO.DisplayName;
                ltlContent.Text = storageFileVO.HtmlContent;
                imgPicFile.ImageUrl = string.Format("common/storagefilepichandler.ashx?fileid={0}", m_StorageFileId);
            }
        }
    }
}